import request from '@/utils/request';
import { stringify } from 'qs';
import func from '@/utils/func';

// 自定义分页三方店铺面单数据
export async function getTableListOp(params) {
  return request(
    `/blade-logistics/userstorefacebill/page?${stringify(params)}`
  );
}

// 找家纺面单数据
export async function getZjfTableListOp(params) {
  return request(
    `/blade-logistics/userstorefacebill/sysExpress?${stringify(params)}`
  );
}

// 基础快递列表
export async function getBaseExpressListOp() {
  return request(`/blade-logistics/express/list`);
}

//平台店铺下拉列表   支持模糊搜索 :storeName (过滤商城)
export async function queryShopList(params) {
  return request(`/blade-goods/ecstore/list?${stringify(params)}`);
}

// 批量同步已开通电子面单
export async function batchSyncFaceSheetOp(params) {
  return request(`/blade-logistics/userstorefacebill/faceSheetSync`, {
    method: 'post',
    data: params,
  });
}

//获取京东店铺列表
export async function getJdStoreListOp(params) {
  return request(`/blade-logistics/userstorefacebill/jdStoreList`, {
    method: 'post',
    data: params,
  });
}

//店铺授权-批量保存或更新京东店铺授权
export async function saveJdCodeOp(params) {
  return request(`/blade-logistics/userstorefacebill/saveJdCode`, {
    method: 'post',
    data: params,
  });
}

// 保存顺丰快递授权
export async function saveSfOp(params) {
  return request(`/blade-logistics/userstorefacebill/saveSf`, {
    method: 'post',
    data: params,
  });
}

// 顺丰快递授权详情（弹窗表单回填）
export async function getSfDetailSfOp(params) {
  return request(
    `/blade-logistics/userstorefacebill/detailSf?${stringify(params)}`
  );
}

// 时效下拉（顺丰弹窗下拉）
export async function getSfPruductListOp(params) {
  return request(`/blade-logistics/sfexpresstype/selectKv?${stringify(params)}`);
}

// 修改顺丰快递授权
export async function updateSfOp(params) {
  return request(`/blade-logistics/userstorefacebill/updateSf`, {
    method: 'post',
    data: params,
  });
}

// 删除顺丰快递授权
export async function delSfOp(params) {
  return request(`/blade-logistics/userstorefacebill/delSf`, {
    method: 'post',
    body: func.toFormData(params),
  });
}

// 获取未绑定的
export async function getUnBingOp(params) {
  return request(
    `/blade-logistics/warehouseexpress/unBing?${stringify(params)}`
  );
}

// 绑定
export async function bingWarehouseOp(params) {
  return request(`/blade-logistics/warehouseexpress/bingWarehouse/batch`, {
    method: 'post',
    body: func.toFormData(params),
  });
}

//解绑
export async function delBingWarehouseOp(params) {
  //id
  return request(
    `/blade-logistics/warehouseexpress/delBingWarehouse?id=${params}`,
    {
      method: 'post',
    }
  );
}

//面单授权列表---极兔
export async function getJituPageOp(params) {
  return request(`/blade-logistics/jitufacebill/page?${stringify(params)}`);
}

// 新增极兔快递授权
export async function addJituAuthoriOp(params) {
  return request(`/blade-logistics/jitufacebill/add`, {
    method: 'post',
    data: params,
  });
}

// 更新极兔快递授权
export async function updateJituOp(params) {
  return request(`/blade-logistics/jitufacebill/update`, {
    method: 'post',
    data: params,
  });
}

// 删除极兔快递授权
export async function deleteJituOp(params) {
  return request(`/blade-logistics/jitufacebill/delById`, {
    method: 'post',
    body: func.toFormData(params),
  });
}

// 查询电子面单余额
export async function queryJitufacebill(params) {
  return request(`/blade-logistics/jitufacebill/balance`, {
    method: 'post',
    body: func.toFormData(params),
  });
}

//快手补充直营快递公司客户编码信息
export async function suppleUserCodeOp(params) {
  return request(`/blade-logistics/userstorefacebill/ksSupplyInfo`, {
    method: 'post',
    data: params,
  });
}

//抖音扩展字段补充（顺丰产品编码）
// export async function douyinExtendsOp(params) {
//   return request(`/blade-logistics/userstorefacebill/douYinExtend`, {
//     method: 'post',
//     data: params,
//   });
// }

//补充客户编码信息 通用
export async function commonSuppleUserCodeOp(params) {
  return request(`/blade-logistics/userstorefacebill/platformSFExtend`, {
    method: 'post',
    data: params,
  });
}

//新增修改单号余量预警
export async function updateExpressNoMonitor(params) {
    return request(`/blade-logistics/userstorefacebill/updateExpressNoMonitor`, {
      method: 'post',
      data: params,
    });
  }